/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ages.input;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

/**
 *
 * @author felix
 */
public class Mouse implements MouseListener {

    private boolean leftClick = false;
    private boolean rightClick = false;
    private XY xy = new XY();
    private MousePoller poller;
    public Mouse(){
        poller = new MousePoller(xy);
        poller.start();
    }

    public int getX(){return xy.x();}
    public int getY(){return xy.y();}
    public boolean leftDown(){ return leftClick;}
    public boolean rightDown(){ return rightClick;}



    public void mouseExited(MouseEvent me) {
    }

    public void mouseEntered(MouseEvent me) {
    }

    public void mouseReleased(MouseEvent me) {
        int temp = me.getButton();
        switch (temp) {
            case MouseEvent.BUTTON1:
                leftClick = false;
                break;
            case MouseEvent.BUTTON2:
                rightClick = false;
                break;
        }
    }

    public void mousePressed(MouseEvent me) {
        int temp = me.getButton();
        switch (temp) {
            case MouseEvent.BUTTON1:
                leftClick = true;
                break;
            case MouseEvent.BUTTON2:
                rightClick = true;
                break;
        }
    }

    public void mouseClicked(MouseEvent me) {
    }
}
